package com.xdcplus.web.common.enums;

import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public enum BdFactoryEnum {
    // 数据操作错误定义
    HP_FACTORY("10", "化抛车间"),
    TOP_FACTORY("20", "TOP车间"),
    PE_FACTORY("30", "PE车间"),
    SY_FACTORY("40", "丝印车间"),
    PACK_FACTORY("50", "包装车间"),

    ;
    public static List<BdFactoryEnum> sortByValue() {
        return Stream.of(values())
                .sorted(Comparator.comparing(BdFactoryEnum::getCode))
                .collect(Collectors.toList());
    }
    private String code;

    private String msg;

    public static String getMsg(String code) {
        for (BdFactoryEnum ele : values()) {
            if(ele.getCode().equals(code)) {return ele.getMsg();}
        }
        return null;
    }

    BdFactoryEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }
}
